<template>
	<uv-sticky :zIndex="zIndex" :customNavHeight="state.customNavHeight" :bgColor="bgColor">
		<slot></slot>
	</uv-sticky>
</template>

<script setup>
	const props = defineProps({
		bgColor: {
			type: String,
			default: '#F6F7F8'
		},
		isComputed: {
			type: Boolean,
			default: true
		},
		zIndex: {
			type: [Number,String],
			default: ''
		}
	})
	const state = reactive({
		//#ifdef H5
		customNavHeight: 44,
		//#endif
		//#ifdef APP
		customNavHeight: 0,
		//#endif
	})
	function getCustomNavHeight() {
		uni.getSystemInfo({
		  success: function (res) {
			  if(!props.isComputed) return state.customNavHeight = 0
		    // 获取状态栏的高度
		    // 默认的导航栏高度，可以根据设计规范进行调整
		    const defaultNavBarHeight = 44; 
		    // 如果有必要，可以根据res.statusBarHeight来调整导航栏的高度
		    const navBarHeight = res.statusBarHeight + defaultNavBarHeight;
			state.customNavHeight = navBarHeight
		  }
		});
	}
	getCustomNavHeight()
</script>

<style>

</style>